package com.huahua.controller;

import com.huahua.annotation.Authority;
import com.huahua.resp.R;
import com.huahua.service.UserService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;

@RestController
@RequestMapping("user")
public class UserController {
    @Autowired
    private UserService userService;

    @GetMapping("/getUser/{id}")
    @Authority(description = "获得用户信息",permissionName = "user:getUser",type = 1)
    R getUser(@PathVariable("id") Integer id) {
        return R.success(userService.queryUser(id));
    }

    @DeleteMapping("deleteUser/{id}")
    @Authority(description = "删除用户信息",permissionName = "user:deleteUser",type = 2,notAllow = 2)
    R deleteUser(@PathVariable("id") Integer id) {
        return R.success(userService.deleteUser(id));
    }
}
